package com.superb.common.doc.config;

import com.superb.common.properties.SupberbKnife4jProperties;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: ajie
 * @CreateTime: 2024-05-06 09:21
 */
@Configuration
public class SuperbKnife4jConfig {

    @Resource
    private SupberbKnife4jProperties properties;

    /**
     * 接口文档描述
     * @return
     */
    @Bean
    public OpenAPI openAPI() {
        return new OpenAPI().info(new Info()
                .title(properties.getTitle())
                .description(properties.getDescription())
                .version(properties.getVersion())
                .contact(new Contact()
                        .name(properties.getAuthor())
                        .email(properties.getEmail())
                )
        );
    }

}
